package com.zzyl.nursing.controller;

import cn.hutool.json.JSONUtil;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.NursingTaskDto;
import com.zzyl.nursing.dto.NursingTaskDtos;
import com.zzyl.nursing.vo.NursingTaskVo;
import com.zzyl.system.mapper.SysUserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.nursing.service.INursingTaskService;

import java.util.List;


/**
 * 护理任务Controller
 * 
 * @author ruoyi
 * @date 2024-09-27
 */
@RestController
@RequestMapping("/nursing/nursingTask")
@Api(tags = "护理任务的接口")
public class NursingTaskController extends BaseController
{
    @Autowired
    private INursingTaskService nursingTaskService;
    @Autowired
    private SysUserMapper userMapper;

    /**
     * 查询护理任务列表
     */
    @ApiOperation("查询护理任务列表")
    @GetMapping("/list")
    public TableDataInfo list(NursingTaskDto nursingTask)
    {
        startPage();
        TableDataInfo info = nursingTaskService.NursingTaskList(nursingTask);
        return info ;

    }

    /**
     * 获取护理任务详细信息
     */
    @ApiOperation("获取护理任务详细信息")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable Long id)
    {
        return success(nursingTaskService.selectNursingTaskById(id));
    }


    @PutMapping("/cancel")
    public AjaxResult Cancel(@RequestBody NursingTaskDtos nursingTaskDtos){
        nursingTaskService.updateByTaskId(nursingTaskDtos);
        return success();
    }

    @PutMapping("/do")
    public AjaxResult fulfillment(@RequestBody NursingTaskDtos nursingTaskDtos ){
      nursingTaskService.fulfillment(nursingTaskDtos);
         return success();
    }

    @PutMapping("/updateTime")
    public AjaxResult updateTime(@RequestBody NursingTaskDtos nursingTaskDtos){
       nursingTaskService.updateTime(nursingTaskDtos);
        return success();
    }
}
